
package com.lzx.iteam.util;


import android.app.ActivityManager;
import android.content.Context;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.Environment;
import android.provider.BaseColumns;
import android.provider.ContactsContract;
import android.provider.ContactsContract.CommonDataKinds;
import android.provider.ContactsContract.Contacts.Data;
import android.telephony.TelephonyManager;
import android.util.Log;
import com.lzx.iteam.provider.CloudContactsDB.CommunicationRule;

import java.io.File;
import java.util.List;

import static android.R.attr.right;


public class Constants {
    public static final boolean DEBUG = true;
    public static final String GROUP_ID = "1470";
    public static final int CRM_PUBLIC_CLUE = 0;
    public static final int CRM_PRIVATE_CLUE = 1;
    public static final int CRM_CHANCE = 2;
    public static final int CRM_CLIENT=3;

    public static final String ACTION_STARTIMER = "com.lzx.iteam.alarm.start.action";
    public static final String ACTION_ACCEPT = "com.lzx.iteam.alarm.accept.action";
    public static final int GROUP_DIALOG = 1001;
    public static final int JOIN_GROUP_DIALOG = 101;
    public static final int CREATE_GROUP = 102;
    public static final int GROUP_UPDATE = 103;
    public static final int GROUP_RESULT = 104;
    public static final String ALIPAY_PN = "com.alipay.android.app";
    public static final String TWO_SIM_PLUGIN = "com.hfx.twosimplugin";
    public static final String MIME_SMS_ADDRESS = "vnd.android.cursor.item/sms-address";
    public static final String SCHEME_TEL = "tel";
    public static final String SCHEME_SMSTO = "smsto";
    public static final String SCHEME_MAILTO = "mailto";
    public static final String SCHEME_IMTO = "imto";
    public static final String SCHEME_SIP = "sip";
    public static final String SCHEME_SMS = "sms";
    public static final String TABLE_NAME_CALLS = "calls";
    public static final int SCREEN_WIDTH = 0;

    public static String NEW_TALK_ID = "";  // 记录新创建的人脉圈的id
    public static String NEW_EVENT_ID = ""; // 记录新创建的事件的id
    public static String NEW_EVENT_REPLY_TIME = ""; // 记录事件新回复的时间
    public static String NEW_CRM_REPLY_TIME = ""; // 记录crm回复的时间
    public static String NEW_LEGWORK_ID = ""; // 记录新创建的外勤的id

    public static int REG_ACTION = 0;

    //跳转到图片Adapter的标志位
    public static  int CREATE_EVENT_TYPE = 1000;
    public static int CREATE_TALK_TYPE = 1001;

    // 跳转到图片显示界面的来源标志位
    public static final  String IMAGE_ORIGIN = "image_origin";
    public static final  String IMAGE_THUME = "image_thume";
    // TODO mImageOrigin Constants.IMAGE_ORIGIN_LOCAL_STRING  本地的地址 传来的图片格式是String
    // TODO mImageOrigin Constants.IMAGE_ORIGIN_LOCAL_ARRAY  本地的地址 传来的图片格式是ArrayList<String>
    // TODO mImageOrigin Constants.IMAGE_ORIGIN_LOCAL_BASE  本地的地址 传来的图片格式是base64
    // TODO mImageOrigin Constants.IMAGE_ORIGIN_URL_ARRAY  url地址 传来的图片格式是ArrayList<String>
    public static final int IMAGE_ORIGIN_LOCAL_STRING=1;
    public static final int IMAGE_ORIGIN_LOCAL_ARRAY=2;
    public static final int IMAGE_ORIGIN_LOCAL_BASE=3;
    public static final int IMAGE_ORIGIN_URL_ARRAY=4;
    public static final String IMAGE_PATH = "imagePath";

    public static final String PHONENUMBER_SPLIT = "&!&";
    public static final String GROUPNAME_SPLIT = "@#$";
    public static final String GROUPNAME_SPLIT_2DISPLAY = ",";

    public static String zYear = "";
    public static String zMonth = "";
    public static String zDay = "0";
    public static float scale = 0.2f;

    // keyboard layout 键盘横竖屏
    public final static int KEYBOARD_LAYOUT_VERTICAL = 1;
    public final static int KEYBOARD_LAYOUT_HORIZONTAL = 2;


    //编辑页面两种ACTION定义
    public static final String EDIT_CONTACT_ACTION = "com.lzx.iteam.action.EDIT";
    public static final String INSERT_CONTACT_ACTION = "com.lzx.iteam.action.INSERT";
    public static final int CONTACTS_MODIFY = 4001;

    //标志主ACTIVITY中ListView中显示的内容
    public static final int SHOW_CONTACT_INFO = 1;
    public static final int SHOW_GROUP_INFO = 3;

    public static final int TYPE_INSERT = 0;

    public static final int TYPE_UPDATE = 1;

    public static final int TYPE_DELETE = 2;

    public static final int TYPE_EQUAL = 3;

    public static final String METHOD = "method";

    //add by lk for chat
    public static final int MT_MSG_TEXT = 101;//文本
    public static final int MT_MSG_VOC = 102;//语音
    public static final int MT_MSG_PIC = 103;//图片
    public static final int MT_MSG_DOC = 104;//文件


    // add by gaotong
    public static final String BULKSMS_BUNDLE = "bulksms_bundle";
    public static final String BULKSMS_SELCONTACT_INTENT = "bulksms_selcontact_intent";

    public static final Uri TEMP_PICTURE_URI = Uri.fromFile(new File(Environment
            .getExternalStorageDirectory(), ".tempContactImg.jpg"));

    //DisplayAllGroupActivity's all return key
    public static final String DISPLAY_ALL_GROUP = "display_all_group";
    public static final String DISPLAY_NO_GROUP = "display_no_group";
    //: delete
//    public static final String DISPLAY_CLOUD_GROUP = "cloud_group";
    public static final String DISPLAY_ALLGROUP_GROUPID = "groupId";
    public static final String DISPLAY_ALLGROUP_GROUPNAME = "groupName";
    public static final String DISPLAY_ALLGROUP_NOGROUP_ID = "noGroupId";

    public static final String CONTACT_NAME_KEY = "name";
    public static final String CONTACT_PHONE_KEY = "phone";
    public static final String CONTACT_ID_KEY = "contactId";
    public static final String CONTACT_NAME_CARD = "contact_name_card";
    // 记录最后一次点击的时间
    private static long lastClickTime;

    public static final int TYPE_NORMAL = 1;

    public static final int TYPE_HEADER = 0;

    public static final int TYPE_FOOTER = 2;

    protected static final int TYPE_COUNT = 3;

    public static final String[] ORDER_BY_NAME = {"姓名排序"};
    public static final int ORDER_BY_NAME_INDEX = 1;

    public static final String[] ORDER_BY_CALL_LOG = {"常用联系", "尚未联系"};
    public static final int ORDER_BY_CALL_LOG_INDEX = 2;

    public static final String CLAUSE_ONLY_PHONES = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=1";
    public static final String CLAUSE_NO_PHONE = ContactsContract.Contacts.HAS_PHONE_NUMBER + "=0";

    public static final String BACK_ERROR_LOGIN = "您的"; // 重新登录

    //black, white list

    public static final int RESULT_NOTINBLACKWHITELIST = -1;
    public static final int RESULT_INBLACKLIST = 0;
    public static final int RESULT_INWHITELIST = 1;

    public static final int COMMUNICATION_STATUS_NOT_INLIST = 1;

    public static final int COMMUNICATION_STATUS_IN_TELEPHONY_BLACK = 2;

    public static final int COMMUNICATION_STATUS_IN_TELEPHONY_WHITE = 3;

    public static final int COMMUNICATION_STATUS_IN_SMS_BLACK = 4;

    public static final int COMMUNICATION_STATUS_IN_SMS_WHITE = 5;

    public static final int COMMUNICATION_STATUS_IN_BLACK = 6;

    public static final int COMMUNICATION_STATUS_IN_WHITE = 7;
    //block
    public static final int BLOCK_MODE_NOT_BLOCK = 1;

    public static final int BLOCK_MODE_BLOCK_BLACK = 2;

    public static final int BLOCK_MODE_PERMIT_WHITE = 3;

    public static final int BLOCK_MODE_STRANGER = 4;

    public static final int GROUP_MODE_FENZU = 5;

    public static final int GROUP_MODE_CITY = 6;

    public static final int GROUP_MODE_NAME = 7;
    //keyboard init status
    // public static final String[] ORDER_BY_CREATE_TIME = {"本周", "本月", "近三月"};
    /**
     * @"今天", @"0",
     * @"近三天", @"0", @"本周", @"0", @"本月", @"0", @"近三月", @"0", @"近半年", @"0",
     * @"近一年", @"0", @"一年前", @"0", nil];
     */

//    public static final int ORDER_BY_CREATE_TIME_INDEX = 3;

    //font size
    public static final int FONT_SIZE_SMALL = 16;

    public static final int FONT_SIZE_MEDIUM = 18;

    public static final int FONT_SIZE_BIG = 28;

    public static final int SOUND_CLOSE = 0;

    public static final int SOUND_DEFAULT = 1;

    public static final int SOUND_THEME = 2;

    public static final int DISPLAYDIP = 160;

    // for DialerContactsActivity
    public static final int APP_START = 1;
    public static final int SETUP_KEYBOARD = 2;
    public static final int CHANGE_SKIN_BEGIN = 3;
    public static final int CHANGE_SKIN_END = 4;
    public static final int UPDATE_SIM_EXPORT = 5;
    public static final int UPDATE_APP = 6;
    public static final int BATCH_DELETE_OVER = 7;
    public static final int FRESH_ALL = 8;
    public static final int FRESH_ON_BACKGROUND = 9;
    public static final int FRESH_SHOWGROUP_TEXT = 10;
    public static final int BATCH_OPERATION_MSG = 11;
    public static final int FRESH_SEND_BUTTON_NUMBER = 12;
    public static final int UPDATE_AREA = 13;
//    public static final int SET_TAB_VISIBLE = 14;
    public static final int SET_TAB_GONE = 15;
    public static final int UPDATE_UI_CREATE = 16;
    public static final int UPDATE_UI_REMOVE = 17;
    public static final int UPDATE_UI_EDIT = 18;
    public static final int UPDATE_UI_PROGRESSBAR = 19;


    //for skin
    public static final int CHANGE_SKIN = 0;
    public static final int QUICK_DIAL_DIALOG = 3;
    public static final int SELECT_KEYBOARD = 2;
    public static final int REMOVE_GROUP = 4;
    public static final int EXIT_GROUP = 5;
    public static final int SWITCH_NAME_CARD = 400;
    public static final int CHOICE_SIM = 7;

    public static final int DIALER_CONTACTS_QUERY_TOKEN = 300;
    public static final int MSG_POST_DELAY = 304;
    public static final int MSG_UPLOAD_DONE = 305;
    public static final int MSG_CLOSE_INPUT = 306;

    public static final int DIALER_CONTACTS_INFO_QUERY_TOKEN = 301;


    //show contacts policiy    
    public static final int SHOW_PEOPLE_WITH_NOPHONENUMBER = 1;

    public static final String COME_FROM_SEND_CARD = "come_from_send_card";
    public static final String YAOYIYAO_FLAG = "yaoyiyao";
    public static final String YAOYIYAO_GROUP_NAME = "yaoyiyao_group_name";
    public static final String YAOYIYAO_GROUP_ID = "yaoyiyao_group_id";
    public static final int YAOYIYAO_SEND = 0;
    public static final int YAOYIYAO_RECEIVE = 1;
    public static final int YAOYIYAO_EXCHANGE = 2;

    //global status,
    public enum MainStatus {
        Starting,
        BackInitSuccessed,
        ListInitSuccessed,
        Running, Stopped, Completed
    }

    ;

    //sub status belong to Starting
    public enum StartingStatus {

    }

    ;

    //sub status belong to Running 
    public enum RunningStatus {

    }

    ;

    //address
    public static final String ADDRESS_LABEL_STREET = "Street";
    public static final String ADDRESS_LABEL_CITY = "City";
    public static final String ADDRESS_LABEL_STATE = "State";
    public static final String ADDRESS_LABEL_ZIP = "ZIP";
    public static final String ADDRESS_LABEL_COUNTRY = "Country";
    public static final String ADDRESS_LABEL_COUNTRYCODDE = "CountryCode";

    //phone label
    public static final String PHONE_LABEL_MOBILE = "_$!<Mobile>!$_";
    public static final String PHONE_LABEL_IPHONE = "iPhone";
    public static final String PHONE_LABEL_MAIN = "_$!<Main>!$_";
    public static final String PHONE_LABEL_HOMEFAX = "_$!<HomeFAX>!$_";
    public static final String PHONE_LABEL_WORKFAX = "_$!<WorkFAX>!$_";
    public static final String PHONE_LABEL_PAGER = "_$!<Pager>!$_";

    //URL
    public static final String URL_LABEL_HOMEPAGE = "_$!<HomePage>!$_";

    //EMAIL label
    public static final String GENERAL_LABEL_WORK = "_$!<Work>!$_";
    public static final String GENERAL_LABEL_HOME = "_$!<Home>!$_";
    public static final String GENERAL_LABEL_OTHER = "_$!<Other>!$_";

    //activity request
    public final static int ACTIVITY_REQUEST_GETALLGROUPACTIVITY = 20;

    public final static int ACTIVITY_REQUEST_DISPLAYCOMMUNICATION = 21;

    public final static int ACTIVITY_REQUEST_DISPLAYPHONEOPERATION = 22;

    public final static int ACTIVITY_REQUEST_KEYBOARDSTYLE = 24;

    public final static int ACTIVITY_REQUEST_SETTINGACTIVITY = 25;

    public final static int ACTIVITY_REQUEST_SHARE_NAMECARD = 26;

    public final static int ACTIVITY_REQUEST_RECEIVECARD = 27;

    public final static int ACTIVITY_REQUEST_GROUPOPERATION = 28;

    public final static int ACTIVITY_REQUEST_BATCHOPERATION = 29;

    public final static int ACTIVITY_REQUEST_EDITCONTACT = 30;

    public final static int ACTIVITY_REQUEST_EDITCLOUDCONTACT = 31;

    public final static int ACTIVITY_REQUEST_EDITGROUP = 230;

    public final static int ACTIVITY_REQUEST_DISPLAYCONTACT = 31;

    public final static int ACTIVITY_REQUEST_SETBLACKLIST = 32;

    public final static int ACTIVITY_REQUEST_BULK_SENDSMS = 33;

    public final static int ACTIVITY_REQUEST_SEND_MULTICARD = 34;

    public final static int ACTIVITY_REQUEST_SIM_IMPORT = 35;

    public final static int ACTIVITY_REQUEST_IMPORTEXPORT = 36;

    public final static int ACTIVITY_REQUEST_SD_IMPORT = 37;

    public final static int ACTIVITY_REQUEST_INSERTCONTACTACTIVITY_FOR_SWITCHCARD = 38;

    public final static int ACTIVITY_REQUEST_DELETET = 39;

    public final static int ACTIVITY_REQUEST_ADD_GROUP_CONTACT=40;
    public final static int ACTIVITY_REQUEST_ADD_MEMBER=41;

    public final static int NAMECARD_RETURN_FIND = 3;

    public final static int NAMECARD_RETURN_SEND_NAMECARD = 4;

    public final static int BLACK_LIST_RETURN_FIND = 5;

    public final static int WHITE_LIST_RETURN_FIND = 6;

    public final static int SETTING_RETURN_FIND_BLACKLIST = 7;

    public final static int SETTING_RETURN_FIND_WHITELIST = 8;

    public final static String NAMECARD_PATH = "/namecard";

    public final static int SHARE_POLICY_ONLY_RECEIVE = 1;

    public final static int SHARE_POLICY_EXCHANGE = 2;

    public final static int SHARE_POLICY_ONLY_SEND = 3;

    public final static int BATCH_OPERATION_CLOUD_UPLOAD = 12;
    public final static int BATCH_OPERATION_BLACK_LIST = 13;
    public final static int BATCH_OPERATION_WHITE_LIST = 14;
//    public final static int BATCH_OPERATION_INVITE = 18;
    public final static int BATCH_OPERATION_INVITE_MANAGER = 19;
    public final static int BATCH_OPERATION_ADD_LOCAL_CHAT_MEMBER = 20;
    public final static int BATCH_OPERATION_ADD_CLOUD_CHAT_MEMBER = 21;
    public final static int BATCH_OPERATION_ADD_GROUP_MEMBER=22;
    public final static int BATCH_OPERATION_MANAGER_ADD=23;
    public final static int BATCH_OPERATION_MEMBER_DELETE=24;
    public final static int BATCH_OPERATION_EVENT_ADD_RECEIVER=25;
    public final static int BATCH_OPERATION_EVENT_ADD_LOCAL_RECEIVER=26;
    public final static int BATCH_OPERATION_SCHEDULE_MANAGER=27;
    public final static int BATCH_OPERATION_ATTENDANCE_MEMBER=28;
    public final static int BATCH_OPERATION_APPROVAL_LEADER=29;
    public final static int BATCH_OPERATION_WEEKLY_MANAGER=30;

    public final static int CHECKBOX_STATUS_BUSINESSCARD = 1;

    public final static int CHECKBOX_STATUS_BUSINESSCARD_WITHSMS = 2;

    public final static int CHECKBOX_STATUS_SELECT_BLACKLIST = 3;

    public final static int CHECKBOX_STATUS_SELECT_WHITELIST = 4;

    public final static int CHECKBOX_STATUS_DELETE_CALL_LOG = 5;

    public final static int CHECKBOX_STATUS_SAVE2_OLD_CONTACT = 6;

    public final static int CHECKBOX_STATUS_SELECT_CONTACT_URI = 7;

    public final static int KEY_FIRST_INVERSE = 1;

    public final static int KEY_FIRST_CLOCKWISE = 2;

    public final static int KEY_SECOND_INVERSE = 3;

    public final static int KEY_SECOND_CLOCKWISE = 4;

    public final static int NONE_NUMBER = 213;

    public static final int DELETE_AT_ONCE = 20;

    public static final int ERR_NONE = 0;

    public static final int ERR_CANCEL = 1;

    public static final int ERR_UNKNOWN = 2;

    public static final int ERR_CANCEL_BY_ACTIVITY = 3;

    public static final int DELETE_INTERVAL = 50;

    public final static int ACTIVITY_RESULT_DISPLAYCOMMUNICATION_DELETE = 0;
    public final static int ACTIVITY_RESULT_DISPLAYCOMMUNICATION_SHARE = 1;
    public final static int ACTIVITY_RESULT_DISPLAYCOMMUNICATION_GROUP = 2;
    public static final int ACTIVITY_RESULT_CLOUD_CONTACT_DELETE = 10001;
    public final static int ACTIVITY_RESULT_SAVE2_OLD_CONTACT = 10002;
    public static final int ACTIVITY_RESULT_CLEAR_DIAL_NUM = 10003;

    public static final int IMPORT_PROCESS = 0;

    public static final int EXPORT_PROCESS = 1;

    public static final int TARGET_SIM = 0;

    public static final int TARGET_SD = 1;

    public static final String INTENT_BACKUP_PROCESS_EXTRA = "backup_process";

    public static final String INTENT_BACKUP_TARGET_EXTRA = "backup_target";

    public static final String INTENT_FLAG_PHONENUMBER = "PhoneNumber";
    public static final String INTENT_FLAG_PHONELABLE = "PhoneLable";
    public static final String INTENT_FLAG_CONTACTNAME = "ContactName";
    public static final String INTENT_FLAG_URL = "url";
    public static final String INTENT_FLAG_CONTACTID = "ContactID";
    public static final String INTENT_FLAG_PHOTOID = "PhotoID";
    public static final String INTENT_FLAG_EMAILVALUE = "EmailValue";
    public static final String INTENT_FLAG_ISHAVENAME = "IsHaveName";
    public static final String INTENT_FLAG_ISCALLLOG = "IsCallLog";
    public static final String INTENT_FLAG_CALLLOGID = "CallLogId";
    public static final String INTENT_FLAG_REAL_CALL_LOG_ID = "intent_flag_real_call_log_id";
    public static final String INTENT_FLAG_ALL_DATA = "intent_flag_holder";

    public static final String INTENT_FLAG_PHONENUMBER_DIAL = "PhoneNumberToDial";
    public static final String INTENT_FLAG_PHONENUMBER_SENDSMS = "PhoneNumberToSendSms";
    public static final String INTENT_FLAG_PHONENUMBER_SENDEMAIL = "SendEmail";
    public static final String INTENT_FLAG_PHONENUMBER_DIALIP = "PhoneNumberToDialIP";

    public static final int NORMAL_DIAL = 1;
    public static final int SEND_SMS = 2;
    public static final int IP_DIAL = 3;
    public static final int ROAMING_CALL_BACK = 4;
    public static final int PRECODE_CALL = 5;
    public static final int CREATE_SHORTCUT = 10;
    public static final int CHEAP_CALL = 11;
    public static final int CHEAP_SMS = 12;

    public static final String INTENT_FLAG_PHONENUMBER_OPERATION = "PhoneNumberOp";

    public static final String CURRENT_ACTIVITY = "current_activity";

    public static final String TAB_CONTACT_GROUP = "tab_contact_group";

    //global message
    public final static int GLOBAL_MSG_REGISTER_CLIENT = 1;

    public final static int GLOBAL_MSG_UNREGISTER_CLIENT = 2;

    public final static int GLOBAL_MSG_UPDATE_SEARCHSCOPE = 3;

    /**
     * Pinned header state: don't show the header.
     */
    public static final int PINNED_HEADER_GONE = 0;

    /**
     * Pinned header state: show the header at the top of the list.
     */
    public static final int PINNED_HEADER_VISIBLE = 1;

    /**
     * Pinned header state: show the header. If the header extends beyond the * bottom of the first shown element, push it up and clip.
     */
    public static final int PINNED_HEADER_PUSHED_UP = 2;

    /**
     * extra keys for camera to set the bitmap
     */
    public static final String EXTRA_PHOTO_BITMAP = "photo_bitmap";

    /**
     * The value of the SHOWIMPORTGUIDE_KEY, indicating that the guide should
     * indeed be shown at startup.
     */

    /**
     * The value of the SHOWIMPORTGUIDE_KEY, indicating that the guide should
     * not be shown at startup.
     */

    //call show contact info 
    public static final int CALL_SHOW_CONTACT_DISPLAY = 11;
    public static final int CALL_SHOW_CONTACT_CANCEL = 12;

    public static final int REDIAL_ENDCALL_DISPLAY = 1;
    public static final int REDIAL_ENDCALL_CANCEL = 2;
//    public static final int ADD_CONTACT_DISPLAY = 3;

    /**
     * The value indicating a expandable view object that the AlertDialog shown
     * when pressing label buttons in edit contact activity contains.
     */
    public static final int EDIT_CONTACT_LABEL_BUTTON_DIALOG_EXPANDABLE_VIEW_ID = 99999;

    public static final String GOOGLE_MY_CONTACTS_GROUP = "System Group: My Contacts";
    public static final String GOOGLE_MY_CONTACTS_GROUP_NAME = "我的联系人";

    public static final String GOOGLE_CO_WORKERS_GROUP = "System Group: Coworkers";
    public static final String GOOGLE_CO_WORKERS_GROUP_NAME = "同事";

    public static final String GOOGLE_FAMILY_GROUP = "System Group: Family";
    public static final String GOOGLE_FAMILY_GROUP_NAME = "家人";

    public static final String GOOGLE_FRIENDS_GROUP = "System Group: Friends";
    public static final String GOOGLE_FRIENDS_GROUP_NAME = "朋友";

    public static final String GOOGLE_STARRED_GROUP = "Starred in Android";
    public static final String GOOGLE_STARRED_GROUP_NAME = "关注";

    public static final class ExtendHrPhoto implements BaseColumns {
        /**
         * This utility class cannot be instantiated
         */
        private ExtendHrPhoto() {
        }

        /**
         * MIME type used when storing this in data table.
         */
        public static final String CONTENT_ITEM_TYPE =
                "vnd.android.cursor.item/vnd.sonyericsson.android.hrphoto";

        /**
         * The id of photo.
         * <p/>
         * Type: INTEGER
         */
        public static final String PHOTO_ID = Data.DATA1;

        /**
         * The timestamp of this hrphoto.
         * <p/>
         * Type: INTEGER (long)
         */
        public static final String TIMESTAMP = Data.DATA2;

        /**
         * High resolusion photo of the raw contact. This is the raw bytes of an image
         * that could be inflated using {@link android.graphics.BitmapFactory}.
         * <p/>
         * Type: BLOB
         */
        public static final String HR_PHOTO = Data.DATA15;


    }

    public static final class ExtendData {
        /**
         * This utility class cannot be instantiated
         */
        private ExtendData() {
        }

        /**
         * The content:// style URI for this table
         */
        public static final Uri CONTENT_URI =
                Uri.withAppendedPath(ContactsContract.AUTHORITY_URI, "semc_data");

    }


    public static final String[] COMMUNICATION_RULE_PROJECTION = new String[]{
            CommunicationRule.CONTACT_ID,
            CommunicationRule.PHONE_NUMBER,
            CommunicationRule.PATTERN,
            CommunicationRule.CONTACT_NAME
    };


    public static final String[] SEARCH_PHONENUMBER_COLUMNS = new String[]{
            CommonDataKinds.Phone.CONTACT_ID,
            CommonDataKinds.Phone.TIMES_CONTACTED
    };

    public static final String QUERY_URL = "http://www.mapdigit.com/guidebeemap/offsetinchina.php";

    public static final String CODE_EMAIL = "email";
    public static final String CODE_PHONE = "phone";
    public static final String CODE_COM = "company";
    public static final String CODE_ADDRESS = "address";
    public static final String CODE_WEBSITE = "web_site";
    public static final String CODE_DISPLAYNAME = "display_name";

    public static final String APP_ID = "wxb6382353d0964f46";

    public static final String FRIEND_CRICLE = "vnd.android.cursor.item/vnd.com.tencent.mm.plugin.sns.timeline";
    public static final String WX_CHAT = "vnd.android.cursor.item/vnd.com.tencent.mm.chatting.profile";
    public static final String WX_FLAG = "wx_contact:";
    public static final int MSG_WX = 100;
    public static final int REQUEST_FRESH = 3121;
    public static final int GROUP_OPERATION = 3131;
    public static final int REQUEST_SMS_INSERT = 3141;
    public static final String RECEIVE = "receive";

    public static final int FRESH_STATE = 3151;
    public static final int CLOSE_CAPTURE = 3161;
    public static final String INTENT_URL = "intent_url";
    public static final String START_TIME = "start_time";
    public static final String TEST_TAG = "test_tag";
    public static final String WX_IDS_SET = "wx_ids_set";
    public static final String INTENT_TAG_ID = "tag_id";
    public static final String INTENT_TAG_NAME = "intent_tag_name";
    public static final String CHEAP_CALL_FILE_NAME = "cheap_call_data.obj";
    public static final String SECOND_CALL_FILE_NAME = "second_call_data.obj";
    //displayContactsActivity  status
    public static final int STATUS_IP_CALL = 1;
    public static final int STATUS_DX_CALL = 2;
    public static final int STATUS_SC_CALL = 3;
    public static final String ACTION_DO_CLOSE = "action_do_close";
    public static final int TYPE_MULTI_CALL = 0;
    public static final int TYPE_NORMAL_CALL = 1;
    public static final String INSERT_PHOTO = "insert_photo";
    public static final int MSG_DATA_READY = 333;
    public static final int MSG_CLEAN_UP = 102;
    public static final int MSG_SHOW_NAERBY = 102;
    public static final int MSG_SHOW_NOFREND = 103;
    public static final int MSG_REGISTER_DONE = 101;
    public static final int MSG_CARDDATA_READLY = 104;
    public static final int MSG_GET_CLOUD_GROUP = 444;
    public static final String NAME_FLAG = "通过“团队”发送";
    public static int TAG_COUNT = 0;
    public static boolean IS_DELETE = false; // 聊天记录是否删除的标志
    public static String NETWORK_WRROR = "网络异常，请检查您的网络";

    public static final String TALK_ID = "talk_id"; // 评论或者点赞的这一条talk的id
    public static final String TALK_ABOUT_ID = "talk_about_id"; //这一条回复的id
    public static final String TALK_USER_NAME = "talk_user_name";//
    public static final String TALK_USER_ID = "talk_user_id";//
    public static final String TALK_USER_IMG = "talk_user_img";//
    public static final String TALK_TYPE = "talk_type";//类型，1点赞，2.评论,3.回复
    public static final String TALK_COMMENT = "talk_comment";//回复的内容
    public static final String TALK_CREATE_TIME = "talk_create_time";//回复的时间
    public static final String TALK_REPLY_ID  = "talk_reply_id";//回复人的uid, 如 xx(user_id)回复xxx(reply_uid):
    public static final String TALK_REPLY_NAME = "talk_reply_name";//回复人的名字xxx

    public static final String COMMENT_CONTENT = "comment_content";
    public static final String COMMENT_CREATE_TIME= "comment_create_time";
    public static final String COMMENT_USER_ID= "comment_user_id";
    public static final String COMMENT_USER_NAME= "comment_user_name";

    public static String getVersionName(Context c) {
        PackageInfo packInfo = null;
        try {
            packInfo = c.getPackageManager().getPackageInfo(c.getPackageName(), 0);
        } catch (PackageManager.NameNotFoundException e) {
            e.printStackTrace();
        }

        return (packInfo != null ? packInfo.versionName : "?");
    }

    public static int getVersionCode(Context context) {
        try {
            PackageInfo pi = context.getPackageManager().getPackageInfo(context.getPackageName(), 0);
            return pi.versionCode;
        } catch (PackageManager.NameNotFoundException e) {
            // Auto-generated catch block
            e.printStackTrace();
            return 0;
        }
    }

    public static boolean isConnect(Context context){

        ConnectivityManager mCm = (ConnectivityManager) context.getSystemService(
                Context.CONNECTIVITY_SERVICE);
        NetworkInfo info = mCm.getActiveNetworkInfo();
        if (info == null) return false;
        return info.isConnected();

    }

    public static String getDeviceId(Context context) {
        try {
            TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
            return tm.getDeviceId();
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }

    }

    /**
     * 根据手机的分辨率从 dp 的单位 转成为 px(像素)
     */
    public static int dip2px(Context context, float dpValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (dpValue * scale + 0.5f);
    }

    /**
     * 根据手机的分辨率从 px 的单位 转成为 dp
     */
    public static int px2dip(Context context, float pxValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (pxValue / scale + 0.5f);
    }

    public static int sp2px(Context context, float spValue) {
        final float scale = context.getResources().getDisplayMetrics().density;
        return (int) (spValue * scale + 0.5f);
    }

    public synchronized static boolean isFastClick() {
        long time = System.currentTimeMillis();
        if ( time - lastClickTime < 800) {
            return true;
        }
        lastClickTime = time;
        return false;
    }

    /**
     * @param year
     * @param month
     * @return
     */
    public static int getDay(int year, int month) {
        int day = 30;
        boolean flag = false;
        if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0){
            flag = true;
        }
        switch (month) {
            case 1:
            case 3:
            case 5:
            case 7:
            case 8:
            case 10:
            case 12:
                day = 31;
                break;
            case 2:
                day = flag ? 29 : 28;
                break;
            default:
                day = 30;
                break;
        }
        return day;
    }

    /**
     * 判断应用在前台还是后台运行
     * @param context
     * @return
     */
    public static boolean isBackground(Context context) {
        ActivityManager activityManager = (ActivityManager) context
                .getSystemService(Context.ACTIVITY_SERVICE);
        List<ActivityManager.RunningAppProcessInfo> appProcesses = activityManager
                .getRunningAppProcesses();
        for (ActivityManager.RunningAppProcessInfo appProcess : appProcesses) {
            if (appProcess.processName.equals(context.getPackageName())) {
                /*
                BACKGROUND=400 EMPTY=500 FOREGROUND=100
                GONE=1000 PERCEPTIBLE=130 SERVICE=300 ISIBLE=200
                 */
                Log.i(context.getPackageName(), "此appimportace ="
                        + appProcess.importance
                        + ",context.getClass().getName()="
                        + context.getClass().getName());
                if (appProcess.importance != ActivityManager.RunningAppProcessInfo.IMPORTANCE_FOREGROUND) {
                    Log.i("Service", "处于后台"
                            + appProcess.processName);
                    return true;
                } else {
                    Log.i("Service", "处于前台"
                            + appProcess.processName);
                    return false;
                }
            }
        }
        return false;
    }


    public static Object persisWorkerlock = new Object();
    public static Object InstanceLock = new Object();
    public static boolean IS_START_UP = true;

    public static final int CHATGROUP_DETAIL=10093;
    public static final int CHATGROUP_ADD=10094;
    public static final int CHATGROUP_LIST=10095;
    public static final int MANAGER_GROUP_NORMAL=10097;
    public static final int SELECT_IMG_BACK=10098;
    public static final int CHATGROUP_LIST_COUNT=10099;


}
